""" article模型验证/DTO """

from typing import Optional
from pydantic import BaseModel, Field


class ArticleBase(BaseModel):
    title: str = Field(..., max_length=500, description="标题不超过500个字符")
    description: Optional[str] = Field(..., max_length=1024, description="文章概述不超过1024个字符")
    cate_id: int
    content: str


class ArticleCreate(ArticleBase):
    pass


class ArticleUpdate(ArticleBase):
    id: int
    # title: str
    # description: Optional[str]
    # content: str


class Article(ArticleBase):
    id: int
    cate_id: int
    # title: str
    # description: Optional[str]
    # content: str
    updated_at = str

    class Config:
        orm_mode = True
